package com.demostic.demostic_test.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.demostic.demostic_test.R;
import com.demostic.demostic_test.adapter.TypeAdapter;
import com.demostic.demostic_test.base.BaseActivity;
import com.demostic.demostic_test.utils.Constants;
import com.demostic.demostic_test.utils.MyLog;
import com.demostic.demostic_test.utils.WifiUtils;

public class SelectActivity_ extends BaseActivity {
    public static final String KEY_SUBDOMAIN = "select_subdomain";
    final String TAG = SelectActivity_.class.getSimpleName();
    private TypeAdapter adapter;
    private Context context;
    private ImageView image_back;
    private Intent intent;
    private RecyclerView recyclerView;
    private String[] strArray;
    private String[] subdomainArray;

    @Override // com.demostic.demostic_test.base.BaseActivity, android.support.v7.app.AppCompatActivity, android.support.v4.app.FragmentActivity, android.app.Activity
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_select_);
        initData();
        initView();
    }

    public void initData() {
        this.strArray = getResources().getStringArray(R.array.device_name);
        this.subdomainArray = new String[]{Constants.subdomain_x420, "zhiyitest", Constants.subdomain_x610, Constants.subdomain_x620, "ilifex660", "ilifex660", Constants.subdomain_x782, Constants.subdomain_x785, Constants.subdomain_x786, Constants.subdomain_x787, Constants.subdomain_x790, Constants.subdomain_x800, "ilifex900", Constants.subdomain_x901, "ilifex900"};
    }

    private void initView() {
        this.context = this;
        this.adapter = new TypeAdapter(this.context, this.strArray);
        this.recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
        this.recyclerView.setLayoutManager(new LinearLayoutManager(this.context));
        this.recyclerView.setAdapter(this.adapter);
        this.image_back = (ImageView) findViewById(R.id.image_back);
        this.image_back.setOnClickListener(new View.OnClickListener() {
            /* class com.demostic.demostic_test.activity.SelectActivity_.AnonymousClass1 */

            @Override // android.view.View.OnClickListener
            public void onClick(View v) {
                SelectActivity_.this.finish();
            }
        });
        this.adapter.setContentClickListener(new TypeAdapter.OnContentClickListener() {
            /* class com.demostic.demostic_test.activity.SelectActivity_.AnonymousClass2 */

            @Override // com.demostic.demostic_test.adapter.TypeAdapter.OnContentClickListener
            public void onContentClick(int position) {
                if (WifiUtils.isWifiConnected(SelectActivity_.this.context)) {
                    SelectActivity_.this.intent = new Intent(SelectActivity_.this, ApGuideActivity.class);
                    SelectActivity_.this.intent.putExtra("subdomain", SelectActivity_.this.subdomainArray[position]);
                    SelectActivity_.this.startActivity(SelectActivity_.this.intent);
                    MyLog.e(SelectActivity_.this.TAG, "select==:" + SelectActivity_.this.subdomainArray[position]);
                    return;
                }
                SelectActivity_.this.startActivity(new Intent(SelectActivity_.this, WifiActivity.class));
            }
        });
    }
}
